package me.mock.ao;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodReplacement;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;

public class LoadPackageHook implements IXposedHookLoadPackage
{
	@Override
	public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable
	{
		if (!lpparam.packageName.equals("com.huawei.svn.hiwork"))
			return;
		XposedBridge.log("ao package loaded");

		findAndHookMethod("java.io.File", lpparam.classLoader, "exists", new FileExistsHook());

		findAndHookMethod("android.app.admin.DevicePolicyManager", lpparam.classLoader, "wipeData", int.class,
				XC_MethodReplacement.DO_NOTHING);

		findAndHookMethod("android.app.admin.DevicePolicyManager", lpparam.classLoader, "lockNow",
				XC_MethodReplacement.DO_NOTHING);
	}
}
